import Mock from 'mockjs'

export default {
  mockData () {
    // BASE_PATH
    const BASE_PATH = process.env.BASE_URL.endsWith('/')
      ? process.env.BASE_URL.substr(0, process.env.BASE_URL.length - 1)
      : process.env.BASE_URL

    // 登陆
    Mock.mock(BASE_PATH + '/api/user/login', {
      'code': 1,
      'token': 'fdsjfhjkdshfkldsajfjasdfbjsdkfhsdajfj',
      'result': {
        'id': '100001',
        'name': '林锦泽',
        'roles': ['admin']
      }
    })

    // 注册
    Mock.mock(BASE_PATH + '/api/user/register', {
      'code': 1
    })
  }
}
